package com.ejoysoft.wlanyz.business;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
import java.util.List;
import com.ejoysoft.auth.MD5;
import com.ejoysoft.common.Constants;
import com.ejoysoft.common.DbConnect;
import com.ejoysoft.common.Format;
import com.ejoysoft.common.Globa;
import com.ejoysoft.common.UID;



public class Environment {
	private Globa globa;
    private DbConnect db;


    public Environment() {
    }

    public Environment(Globa globa) {
        this.globa = globa;
        db = globa.db;
    }

    public Environment(Globa globa, boolean b) {
        this.globa = globa;
        db = globa.db;
        if (b) globa.setDynamicProperty(this);
    }

    String strTableName = "WLAN_TEST_RESULT";
    String strTableName1 = "WLAN_TASK_INFO";
    String strTableName2 = "WLAN_RESC_HOTPOT";
    String strTableName3 = "rm_device";
    String strTableName4 = "WLAN_RESC_COMUNITY";

    
  
//返回单条记录
    public Environment show(String where) {
        try {
            String strSql = "select * from  " + strTableName + "  ".concat(where);
            ResultSet rs = db.executeQuery(strSql);
            if (rs != null && rs.next())
                return load(rs, true);
            else
                return null;
        } catch (Exception ee) {
            return null;
        }
    }

  //查询符合条件的记录�?�数
    public int getCount(String where ,String strStartTime ,String strEndTime) throws SQLException{
        int count = 0;
        try {
        	if(strStartTime.equals(""))strStartTime = "1000-1-01";
            if(strEndTime.equals(""))strEndTime = "9999-12-30";
            
            String timeWhere = " and a.DTCREATDATE  between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')" ;
            String sql = "SELECT count(distinct a.strApMac) FROM " + strTableName + " a , " + strTableName1 + " b,"+strTableName2+" c, "+strTableName3+" d, "+strTableName4+" e ";
           // System.err.println(sql+"=================");
            if (where.length() > 0) {
                where = where.toLowerCase();
                if (where.indexOf("order") > 0)
                    where = where.substring(0, where.indexOf("order"));
                sql = String.valueOf(sql) + String.valueOf(where)+ String.valueOf(timeWhere);
            }
            ResultSet rs = db.executeQuery(sql);
            if (rs!=null&& rs.next())
                count = rs.getInt(1);
            rs.close();
            return count;
        } catch (Exception ee) {
            ee.printStackTrace();
            return count;
        }
    }



    //记录集转化为对象
    public Environment load(ResultSet rs, boolean isView) {
    	Environment theBean = new Environment();
        
        try {
  
        	theBean.setStrId(rs.getString("strId"));
        	theBean.setStrTaskId(rs.getString("strTaskId"));
        	theBean.setStrText(rs.getString("strText"));
        	theBean.setStrCommunityId(rs.getString("strCommunityId"));
        	theBean.setStrNeiCommunityId(rs.getString("strNeiCommunityId"));
        	theBean.setIntAp_Relevacy_Sucrate(rs.getDouble("intAp_Relevacy_Sucrate"));
            theBean.setIntAp_Relevacy_Delay(rs.getDouble("intAp_Relevacy_Delay"));
            theBean.setIntWeb_Auth_Sucrate(rs.getDouble("intWeb_Auth_Sucrate"));
            theBean.setIntWeb_Off_Sucrate(rs.getDouble("intWeb_Off_Sucrate"));
            
            theBean.setIntPeap_Auth_Sucrate(rs.getDouble("intPeap_Auth_Sucrate"));
            theBean.setIntPeap_Off_Sucrate(rs.getDouble("intPeap_Off_Sucrate"));
            theBean.setIntHttp_Req_Sucrate(rs.getDouble("intHttp_Req_Sucrate"));
            theBean.setIntPing_Sucrate(rs.getDouble("intPing_Sucrate"));
            theBean.setIntFtp_Up_Sucrate(rs.getDouble("intFtp_Up_Sucrate"));
            
            theBean.setIntFtp_Down_Sucrate(rs.getDouble("intFtp_Down_Sucrate"));
            theBean.setIntUser_Seg_Sucrate(rs.getDouble("intUser_Seg_Sucrate"));
            theBean.setIntUser_Roam_Sucrate(rs.getDouble("intUser_Roam_Sucrate"));
            theBean.setIntWeb_Up_Delay(rs.getDouble("intWeb_Up_Delay"));
            theBean.setIntWeb_Down_Delay(rs.getDouble("intWeb_Down_Delay"));
            
            theBean.setIntPeap_Up_Delay(rs.getDouble("intPeap_Up_Delay"));
            theBean.setIntHttp_Resp_Delay(rs.getDouble("intHttp_Resp_Delay"));
            theBean.setIntPing_Delay(rs.getDouble("intPing_Delay"));
            theBean.setIntFtp_Up_Speed(rs.getDouble("intFtp_Up_Speed"));
            theBean.setIntFtp_Down_Speed(rs.getDouble("intFtp_Down_Speed"));
            
            theBean.setIntAp_Corr_Suc_Counts(rs.getDouble("intAp_Corr_Suc_Counts"));
            theBean.setIntAp_Corr_Total_Counts(rs.getDouble("intAp_Corr_Total_Counts"));
            theBean.setIntWeb_Auth_Suc_Counts(rs.getDouble("intWeb_Auth_Suc_Counts"));
            theBean.setIntWeb_Auth_Total_Counts(rs.getDouble("intWeb_Auth_Total_Counts"));
            theBean.setIntWeb_Off_Suc_Counts(rs.getDouble("intWeb_Off_Suc_Counts"));
           
            theBean.setIntWeb_Off_Total_Counts(rs.getDouble("intWeb_Off_Total_Counts"));
            theBean.setIntPeap_Auth_Suc_Counts(rs.getDouble("intPeap_Auth_Suc_Counts"));
            theBean.setIntPeap_Auth_Total_Counts(rs.getDouble("intPeap_Auth_Total_Counts"));
            theBean.setIntPeap_Off_Suc_Counts(rs.getDouble("intPeap_Off_Suc_Counts"));
            theBean.setIntPeap_Off_Total_Counts(rs.getDouble("intPeap_Off_Total_Counts"));
            
            
            theBean.setIntHttp_Req_Suc_Counts(rs.getDouble("intHttp_Req_Suc_Counts"));
            theBean.setIntHttp_Req_Total_Counts(rs.getDouble("intHttp_Req_Total_Counts"));
            theBean.setIntFtp_Up_Suc_Counts(rs.getDouble("intFtp_Up_Suc_Counts"));
            theBean.setIntFtp_Up_Total_Counts(rs.getDouble("intFtp_Up_Total_Counts"));
            theBean.setIntFtp_Down_Suc_Counts(rs.getDouble("intFtp_Down_Suc_Counts"));
            
            
            theBean.setIntFtp_Down_Total_Counts(rs.getDouble("intFtp_Down_Total_Counts"));
            theBean.setIntUser_Seg_Suc_Counts(rs.getDouble("intUser_Seg_Suc_Counts"));
            theBean.setIntUser_Seg_Total_Counts(rs.getDouble("intUser_Seg_Total_Counts"));
            theBean.setIntUser_Roam_Suc_Counts(rs.getDouble("intUser_Roam_Suc_Counts"));
            theBean.setIntUser_Roam_Total_Counts(rs.getDouble("intUser_Roam_Total_Counts"));
        	theBean.setDtCreatDate(rs.getString("dtCreatDate"));
        	theBean.setStrStartTime(rs.getString("strStartTime"));
        	theBean.setStrEndTime(rs.getString("strEndTime"));
        	theBean.setStrNetType(rs.getString("strNetType"));

        } catch (Exception e) {
            e.printStackTrace();
        }
        return theBean;
    }

    

  
  
  //************************获取所有指标**************************
    public Vector<Environment> returnindex(String where,String city, String strHotSpot){
    	Vector<Environment> beans = new Vector<Environment>();
    	
    	try { 
    		String sql = "select a.intAp_Relevacy_Sucrate,a.intAp_Relevacy_Delay,a.intWeb_Auth_Sucrate,a.intWeb_Off_Sucrate,a.intPeap_Auth_Sucrate,a.intPeap_Off_Sucrate," +
    				"a.intHttp_Req_Sucrate,a.intPing_Sucrate,a.intFtp_Up_Sucrate,a.intFtp_Down_Sucrate,a.intUser_Seg_Sucrate,a.intUser_Roam_Sucrate,a.intWeb_Up_Delay,a.intWeb_Down_Delay,intPeap_Up_Delay,a.intHttp_Resp_Delay," +
    				"a.intPing_Delay,a.intFtp_Up_Speed,a.intFtp_Down_Speed,a.intAp_Corr_Suc_Counts,a.intAp_Corr_Total_Counts,a.intWeb_Auth_Suc_Counts,a.intWeb_Auth_Total_Counts,a.intWeb_Off_Suc_Counts,a.intWeb_Off_Total_Counts,a.intPeap_Auth_Suc_Counts," +
    				"a.intPeap_Auth_Total_Counts,a.intPeap_Off_Suc_Counts,a.intPeap_Off_Total_Counts,a.intHttp_Req_Suc_Counts,a.intHttp_Req_Total_Counts,a.intFtp_Up_Suc_Counts, a.intFtp_UP_Total_Counts, a.intFtp_Down_Suc_Counts, a.intFtp_Down_Total_Counts, " +
    				"a.intUser_Seg_Suc_Counts,a.intrssi,a.intUser_Seg_Total_Counts,a.intUser_Roam_Suc_Counts, a.intUser_Roam_Total_Counts from " + strTableName + " a ,"+strTableName1+" b,"+strTableName2+" c ";
			where+=" and b.strhotpotname = c.strid and b.strtaskid = a.strtaskid and c.strcity = '"+city+"' and c.strhotpotname like '%" +strHotSpot+ "%'" ;
    		sql = String.valueOf(sql) + String.valueOf(where);
			//System.out.println("mmmmmmmmmmmmmmmmmmmmm"+sql);
			Statement s = db.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
			ResultSet rs = db.executeQuery(sql);
			 if (rs != null && rs.next()){
				 do{
					 Environment theBean = new Environment();
                 theBean = load2(rs, false);
                 beans.addElement(theBean);
				 }while(rs.next());
			 }
			 rs.close();
	            s.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return beans;
    }
    
    //************************获取所有指标**************************
    public Vector<Environment> returnindex(String where,String city){
    	Vector<Environment> beans = new Vector<Environment>();
    	
    	try { 
    		String sql = "select a.intAp_Relevacy_Sucrate,a.intAp_Relevacy_Delay,a.intWeb_Auth_Sucrate,a.intWeb_Off_Sucrate,a.intPeap_Auth_Sucrate,a.intPeap_Off_Sucrate," +
    				"a.intHttp_Req_Sucrate,a.intPing_Sucrate,a.intFtp_Up_Sucrate,a.intFtp_Down_Sucrate,a.intUser_Seg_Sucrate,a.intUser_Roam_Sucrate,a.intWeb_Up_Delay,a.intWeb_Down_Delay,intPeap_Up_Delay,a.intHttp_Resp_Delay," +
    				"a.intPing_Delay,a.intFtp_Up_Speed,a.intFtp_Down_Speed,a.intAp_Corr_Suc_Counts,a.intAp_Corr_Total_Counts,a.intWeb_Auth_Suc_Counts,a.intWeb_Auth_Total_Counts,a.intWeb_Off_Suc_Counts,a.intWeb_Off_Total_Counts,a.intPeap_Auth_Suc_Counts," +
    				"a.intPeap_Auth_Total_Counts,a.intPeap_Off_Suc_Counts,a.intPeap_Off_Total_Counts,a.intHttp_Req_Suc_Counts,a.intHttp_Req_Total_Counts,a.intFtp_Up_Suc_Counts, a.intFtp_UP_Total_Counts, a.intFtp_Down_Suc_Counts, a.intFtp_Down_Total_Counts, " +
    				"a.intUser_Seg_Suc_Counts,a.intrssi,a.intUser_Seg_Total_Counts,a.intUser_Roam_Suc_Counts, a.intUser_Roam_Total_Counts from " + strTableName + " a ,"+strTableName1+" b,"+strTableName2+" c ";
			where+=" and b.strhotpotname = c.strid and b.strtaskid = a.strtaskid and c.strcity = '"+city+"' " ;
    		sql = String.valueOf(sql) + String.valueOf(where);
			//System.out.println("mmmmmmmmmmmmmmmmmmmmm"+sql);
			Statement s = db.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
			ResultSet rs = db.executeQuery(sql);
			 if (rs != null && rs.next()){
				 do{
					 Environment theBean = new Environment();
                 theBean = load2(rs, false);
                 beans.addElement(theBean);
				 }while(rs.next());
			 }
			 rs.close();
	            s.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return beans;
    }
  //获取所有不重复的地市名*****************************************
    public ArrayList<String> returnCity(String where){
    	ArrayList<String> list = new ArrayList<String>();
    	
    	try{
    		String strSql = "select distinct strCity from wlan_resc_hotpot ".concat(where);
    		System.out.println("strSql:------"+strSql);
    		ResultSet rs = db.executeQuery(strSql);
    		if(rs!=null){
    			while(rs.next()){
    				list.add(rs.getString("strCity"));
    			}
    		}
    	}catch(Exception e){
    		e.printStackTrace();
    	}
    	return list;
    }
    
  //获取某一城市的所有二级热点
    public ArrayList<String> listTwoAcs(String where)
    {
    	ArrayList<String> beans = new ArrayList<String>();
        try {
            String sql = "SELECT distinct(strHotPotName) FROM  " + strTableName2 + " ";
            if (where.length() > 0)
                sql = String.valueOf(sql) + String.valueOf(where);
             ResultSet rs = db.executeQuery(sql);
            if (rs != null && rs.next()) {
                do {
                    beans.add(rs.getString("strHotPotName"));
                } while (rs.next());
            }
            rs.close();
        } catch (Exception ee) {
            ee.printStackTrace();
        }
    	return beans;
    }
    //列表记录集
    public Environment load1(ResultSet rs ,boolean isView) throws SQLException{
    	Environment theBean = new Environment();
        try {
            theBean.setStrId(rs.getString("strId"));
            theBean.setStrCity(rs.getString("strCity"));
            theBean.setStrClassOneHP(rs.getString("strClassonehp"));
            theBean.setStrTown(rs.getString("strTown"));
            theBean.setStrHotPotName(rs.getString("strhotpotname"));
            theBean.setStrLac(rs.getString("strlac"));
            theBean.setStrCI(rs.getString("strCI"));
            theBean.setDevice_Name(rs.getString("device_name"));
            theBean.setStrApMac(rs.getString("strApMac"));
            theBean.setDtCreatDate(rs.getString("dtCreatDate"));
            System.err.println("[[[[[[[[[[[["+rs.getString("strCI")+rs.getString("strlac")+rs.getString("dtCreatDate"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return theBean;
    }
  
  //记录集转化为对象
    public Environment load2(ResultSet rs, boolean isView) {
    	Environment theBean = new Environment();
        try {
        	theBean.setIntAp_Relevacy_Sucrate(rs.getDouble("intAp_Relevacy_Sucrate"));
            theBean.setIntAp_Relevacy_Delay(rs.getDouble("intAp_Relevacy_Delay"));
            theBean.setIntWeb_Auth_Sucrate(rs.getDouble("intWeb_Auth_Sucrate"));
            theBean.setIntWeb_Off_Sucrate(rs.getDouble("intWeb_Off_Sucrate"));
            
            theBean.setIntPeap_Auth_Sucrate(rs.getDouble("intPeap_Auth_Sucrate"));
            theBean.setIntPeap_Off_Sucrate(rs.getDouble("intPeap_Off_Sucrate"));
            theBean.setIntHttp_Req_Sucrate(rs.getDouble("intHttp_Req_Sucrate"));
            theBean.setIntPing_Sucrate(rs.getDouble("intPing_Sucrate"));
            theBean.setIntFtp_Up_Sucrate(rs.getDouble("intFtp_Up_Sucrate"));
            
            theBean.setIntFtp_Down_Sucrate(rs.getDouble("intFtp_Down_Sucrate"));
            theBean.setIntUser_Seg_Sucrate(rs.getDouble("intUser_Seg_Sucrate"));
            theBean.setIntUser_Roam_Sucrate(rs.getDouble("intUser_Roam_Sucrate"));
            theBean.setIntWeb_Up_Delay(rs.getDouble("intWeb_Up_Delay"));
            theBean.setIntWeb_Down_Delay(rs.getDouble("intWeb_Down_Delay"));
            
            theBean.setIntPeap_Up_Delay(rs.getDouble("intPeap_Up_Delay"));
            theBean.setIntHttp_Resp_Delay(rs.getDouble("intHttp_Resp_Delay"));
            theBean.setIntPing_Delay(rs.getDouble("intPing_Delay"));
            theBean.setIntFtp_Up_Speed(rs.getDouble("intFtp_Up_Speed"));
            theBean.setIntFtp_Down_Speed(rs.getDouble("intFtp_Down_Speed"));
            
            theBean.setIntAp_Corr_Suc_Counts(rs.getDouble("intAp_Corr_Suc_Counts"));
            theBean.setIntAp_Corr_Total_Counts(rs.getDouble("intAp_Corr_Total_Counts"));
            theBean.setIntWeb_Auth_Suc_Counts(rs.getDouble("intWeb_Auth_Suc_Counts"));
            theBean.setIntWeb_Auth_Total_Counts(rs.getDouble("intWeb_Auth_Total_Counts"));
            theBean.setIntWeb_Off_Suc_Counts(rs.getDouble("intWeb_Off_Suc_Counts"));
           
            theBean.setIntWeb_Off_Total_Counts(rs.getDouble("intWeb_Off_Total_Counts"));
            theBean.setIntPeap_Auth_Suc_Counts(rs.getDouble("intPeap_Auth_Suc_Counts"));
            theBean.setIntPeap_Auth_Total_Counts(rs.getDouble("intPeap_Auth_Total_Counts"));
            theBean.setIntPeap_Off_Suc_Counts(rs.getDouble("intPeap_Off_Suc_Counts"));
            theBean.setIntPeap_Off_Total_Counts(rs.getDouble("intPeap_Off_Total_Counts"));
            
            
            theBean.setIntHttp_Req_Suc_Counts(rs.getDouble("intHttp_Req_Suc_Counts"));
            theBean.setIntHttp_Req_Total_Counts(rs.getDouble("intHttp_Req_Total_Counts"));
            theBean.setIntFtp_Up_Suc_Counts(rs.getDouble("intFtp_Up_Suc_Counts"));
            theBean.setIntFtp_Up_Total_Counts(rs.getDouble("intFtp_Up_Total_Counts"));
            theBean.setIntFtp_Down_Suc_Counts(rs.getDouble("intFtp_Down_Suc_Counts"));
            
            
            theBean.setIntFtp_Down_Total_Counts(rs.getDouble("intFtp_Down_Total_Counts"));
            theBean.setIntUser_Seg_Suc_Counts(rs.getDouble("intUser_Seg_Suc_Counts"));
            theBean.setIntUser_Seg_Total_Counts(rs.getDouble("intUser_Seg_Total_Counts"));
            theBean.setIntUser_Roam_Suc_Counts(rs.getDouble("intUser_Roam_Suc_Counts"));
            theBean.setIntUser_Roam_Total_Counts(rs.getDouble("intUser_Roam_Total_Counts"));
            theBean.setIntRssi(rs.getDouble("intRssi"));

        } catch (Exception e) {
            e.printStackTrace();
        }
        return theBean;
    }
    
    //通过城市拿到指标值
    
  
  //获取所有结果表记录条数*****************************************
    public int returnReCount(String where){
    	List<String> list = new ArrayList<String>();
    	where = "";
    	try{
    		String strSql = "select distinct strid from WLAN_TEST_RESULT ".concat(where);
    		ResultSet rs = db.executeQuery(strSql);
    		if(rs!=null){
    			while(rs.next()){
    				list.add(rs.getString("strid"));
    			}
    		}
    	}catch(Exception e){
    		e.printStackTrace();
    	}
    	return list.size();
    }
    
  //调出所有地市名称
    public ArrayList<String> getAllCitiesByName( String where)
    {
    	//System.err.println(where+"=========");
    	ArrayList<String>  beans = new ArrayList<String>();
    	String sql = "select distinct(a.strCity) from "+ strTableName4 + " a , " + strTableName3 + " b,"+strTableName2+" c, "+strTableName+" d ";
    	if(where!=null && where.length()>0)
    		sql = sql +where;
    	ResultSet re = db.executeQuery(sql);
    	try {
    	
			if(re != null && re.next())
			{   //String country = re.getString("");
				do{
					String city = re.getString("strCity");
					beans.add(city);
				}while(re.next());
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	return beans;
    }
  //列表记录
    public Vector<Environment> list(String where, int startRow, int rowCount ,String strStartTime ,String strEndTime) throws SQLException{
        Vector<Environment> beans = new Vector<Environment>();
        try {
        	 if(strStartTime.equals(""))strStartTime = "1000-1-01";
             if(strEndTime.equals(""))strEndTime = "9999-12-30";
             
             String timeWhere = " and a.DTCREATDATE  between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')" ; 

            String sql = "SELECT distinct(d.device_name), c.strcity, c.strtown,c.strclassonehp,c.strhotpotname,e.strlac,a.strapmac,e.strci,a.dtcreatdate,a.strid  FROM " 
            	+ strTableName + " a , " + strTableName1 + " b,"+ strTableName2 + " c,"+strTableName3+" d, "+strTableName4+" e";
            sql = String.valueOf(sql) + String.valueOf(where)+String.valueOf(timeWhere) ;//
            //System.out.println(sql+"lllllllllllllllllllllllll");
            Statement s = db.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            if (startRow != 0 && rowCount != 0)
                s.setMaxRows((startRow + rowCount) - 1);
            ResultSet rs = s.executeQuery(sql);
            if (rs != null && rs.next()) {
                if (startRow != 0 && rowCount != 0)
                    rs.absolute(startRow);
                do {
                	Environment theBean = new Environment();
                    theBean = load1(rs,false);
                    beans.addElement(theBean);
                } while (rs.next());
            }
            rs.close();
            s.close();
        } catch (Exception ee) {
            ee.printStackTrace();
        }
        return beans;
    } 
    
  //列表记录
    public Vector<Environment> list1(String where, int startRow, int rowCount ,String strStartTime ,String strEndTime) throws SQLException{
        Vector<Environment> beans = new Vector<Environment>();
        try {
        	 if(strStartTime.equals(""))strStartTime = "1000-1-01";
             if(strEndTime.equals(""))strEndTime = "9999-12-30";
             
             String timeWhere = " and d.DTCREATDATE  between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')" ; 

            String sql = "SELECT distinct(d.device_name), c.strcity, c.strtown,c.strclassonehp,c.strhotpotname,e.strlac,a.strapmac,e.strci,a.dtcreatdate,a.strid  FROM " 
            	+ strTableName + " a , " + strTableName1 + " b,"+ strTableName2 + " c,"+strTableName3+" d, "+strTableName4+" e";
            sql = String.valueOf(sql) + String.valueOf(where)+String.valueOf(timeWhere) ;//
            System.err.println(sql+"lllllllllllllllllllllllll");
            Statement s = db.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            if (startRow != 0 && rowCount != 0)
                s.setMaxRows((startRow + rowCount) - 1);
            ResultSet rs = s.executeQuery(sql);
            if (rs != null && rs.next()) {
                if (startRow != 0 && rowCount != 0)
                    rs.absolute(startRow);
                do {
                	Environment theBean = new Environment();
                    theBean = load1(rs,false);
                    beans.addElement(theBean);
                } while (rs.next());
            }
            rs.close();
            s.close();
        } catch (Exception ee) {
            ee.printStackTrace();
        }
        return beans;
    } 
   
    private String strId;//	
    private String strTaskType;//任务类型
    private String strNetType;//网络类型
    private String strCity;//地市
    private String strTown;//区县
    private String strApMac;//Mac地址
    private String strCommunityId;//小区Id
    private String strLac;//小区区码
    private String strCI;//小区识别
    private String strSiteName;//站名
    private String strSiteType;//站型
    private String strNeiCommunityId;//相邻小区区码
    private String dtCreatDate;//时间
    private String strHotPotName;//二级热点
    private String strClassOneHP;//一级热点
	private String device_Name;//AP名称
    private String strTaskId;//任务Id
    private String strText;//测试结果是否合格

    private double intAp_Relevacy_Sucrate;
    private double intAp_Relevacy_Delay;
    private double intWeb_Auth_Sucrate;
    private double intWeb_Off_Sucrate;
    private double intPeap_Auth_Sucrate;
    private double intPeap_Off_Sucrate;
    private double intHttp_Req_Sucrate;
    private double intPing_Sucrate;
    private double intFtp_Up_Sucrate;   
    private double intFtp_Down_Sucrate;
    private double intUser_Seg_Sucrate;
    private double intUser_Roam_Sucrate;
    private double intWeb_Up_Delay;
    private double intWeb_Down_Delay;
    private double intPeap_Up_Delay;
    private double intHttp_Resp_Delay;
    private double intPing_Delay;
    private double intFtp_Up_Speed;
    private double intFtp_Down_Speed; 
    private double intAp_Corr_Suc_Counts;
    private double intAp_Corr_Total_Counts;
    private double intWeb_Auth_Suc_Counts;
    private double intWeb_Auth_Total_Counts;
    private double intWeb_Off_Suc_Counts;  
    private double intWeb_Off_Total_Counts;
    private double intPeap_Auth_Suc_Counts;
    private double intPeap_Auth_Total_Counts;
    private double intPeap_Off_Suc_Counts;
    private double intPeap_Off_Total_Counts;  
    private double intHttp_Req_Suc_Counts;
    private double intHttp_Req_Total_Counts;
    private double intFtp_Up_Suc_Counts;
    private double intFtp_Up_Total_Counts;
    private double intFtp_Down_Suc_Counts; 
    private double intFtp_Down_Total_Counts;
    private double intUser_Seg_Suc_Counts;
    private double intUser_Seg_Total_Counts;
    private double intUser_Roam_Suc_Counts;
    private double intUser_Roam_Total_Counts;
    private double intRssi;

    private String strStartTime;
    private String strEndTime;
    private String strCarriers;
    
    
    
	public double getIntRssi() {
		return intRssi;
	}

	public void setIntRssi(double intRssi) {
		this.intRssi = intRssi;
	}

	public String getStrCI() {
		return strCI;
	}

	public void setStrCI(String strCI) {
		this.strCI = strCI;
	}

	public String getStrTaskType() {
		return strTaskType;
	}

	public void setStrTaskType(String strTaskType) {
		this.strTaskType = strTaskType;
	}

	public String getStrNetType() {
		return strNetType;
	}

	public void setStrNetType(String strNetType) {
		this.strNetType = strNetType;
	}

	public String getStrCity() {
		return strCity;
	}

	public void setStrCity(String strCity) {
		this.strCity = strCity;
	}

	public String getStrTown() {
		return strTown;
	}

	public void setStrTown(String strTown) {
		this.strTown = strTown;
	}

	

	public String getStrApMac() {
		return strApMac;
	}

	public void setStrApMac(String strApMac) {
		this.strApMac = strApMac;
	}

	public String getStrLac() {
		return strLac;
	}

	public void setStrLac(String strLac) {
		this.strLac = strLac;
	}

	public String getStrSiteName() {
		return strSiteName;
	}

	public void setStrSiteName(String strSiteName) {
		this.strSiteName = strSiteName;
	}

	public String getStrSiteType() {
		return strSiteType;
	}

	public void setStrSiteType(String strSiteType) {
		this.strSiteType = strSiteType;
	}

	public String getStrHotPotName() {
		return strHotPotName;
	}

	public void setStrHotPotName(String strHotPotName) {
		this.strHotPotName = strHotPotName;
	}

	public String getStrClassOneHP() {
		return strClassOneHP;
	}

	public void setStrClassOneHP(String strClassOneHP) {
		this.strClassOneHP = strClassOneHP;
	}

	public String getDevice_Name() {
		return device_Name;
	}

	public void setDevice_Name(String deviceName) {
		device_Name = deviceName;
	}

	public double getIntFtp_Up_Total_Counts() {
		return intFtp_Up_Total_Counts;
	}

	public void setIntFtp_Up_Total_Counts(double intFtpUpTotalCounts) {
		intFtp_Up_Total_Counts = intFtpUpTotalCounts;
	}

	public String getStrCarriers() {
		return strCarriers;
	}

	public void setStrCarriers(String strCarriers) {
		this.strCarriers = strCarriers;
	}

	public String getStrId() {
		return strId;
	}

	public void setStrId(String strId) {
		this.strId = strId;
	}

	public String getStrTaskId() {
		return strTaskId;
	}

	public void setStrTaskId(String strTaskId) {
		this.strTaskId = strTaskId;
	}

	public String getStrText() {
		return strText;
	}

	public void setStrText(String strText) {
		this.strText = strText;
	}

	public String getStrCommunityId() {
		return strCommunityId;
	}

	public void setStrCommunityId(String strCommunityId) {
		this.strCommunityId = strCommunityId;
	}

	public String getStrNeiCommunityId() {
		return strNeiCommunityId;
	}

	public void setStrNeiCommunityId(String strNeiCommunityId) {
		this.strNeiCommunityId = strNeiCommunityId;
	}

	

	public Globa getGloba() {
		return globa;
	}

	public void setGloba(Globa globa) {
		this.globa = globa;
	}

	public DbConnect getDb() {
		return db;
	}

	public void setDb(DbConnect db) {
		this.db = db;
	}

	public String getStrTableName() {
		return strTableName;
	}

	public void setStrTableName(String strTableName) {
		this.strTableName = strTableName;
	}

	public String getStrTableName1() {
		return strTableName1;
	}

	public void setStrTableName1(String strTableName1) {
		this.strTableName1 = strTableName1;
	}

	public String getStrTableName2() {
		return strTableName2;
	}

	public void setStrTableName2(String strTableName2) {
		this.strTableName2 = strTableName2;
	}

	public double getIntAp_Relevacy_Sucrate() {
		return intAp_Relevacy_Sucrate;
	}

	public void setIntAp_Relevacy_Sucrate(double intApRelevacySucrate) {
		intAp_Relevacy_Sucrate = intApRelevacySucrate;
	}

	public double getIntAp_Relevacy_Delay() {
		return intAp_Relevacy_Delay;
	}

	public void setIntAp_Relevacy_Delay(double intApRelevacyDelay) {
		intAp_Relevacy_Delay = intApRelevacyDelay;
	}

	public double getIntWeb_Auth_Sucrate() {
		return intWeb_Auth_Sucrate;
	}

	public void setIntWeb_Auth_Sucrate(double intWebAuthSucrate) {
		intWeb_Auth_Sucrate = intWebAuthSucrate;
	}

	public double getIntWeb_Off_Sucrate() {
		return intWeb_Off_Sucrate;
	}

	public void setIntWeb_Off_Sucrate(double intWebOffSucrate) {
		intWeb_Off_Sucrate = intWebOffSucrate;
	}

	public double getIntPeap_Auth_Sucrate() {
		return intPeap_Auth_Sucrate;
	}

	public void setIntPeap_Auth_Sucrate(double intPeapAuthSucrate) {
		intPeap_Auth_Sucrate = intPeapAuthSucrate;
	}

	public double getIntPeap_Off_Sucrate() {
		return intPeap_Off_Sucrate;
	}

	public void setIntPeap_Off_Sucrate(double intPeapOffSucrate) {
		intPeap_Off_Sucrate = intPeapOffSucrate;
	}

	public double getIntHttp_Req_Sucrate() {
		return intHttp_Req_Sucrate;
	}

	public void setIntHttp_Req_Sucrate(double intHttpReqSucrate) {
		intHttp_Req_Sucrate = intHttpReqSucrate;
	}

	public double getIntPing_Sucrate() {
		return intPing_Sucrate;
	}

	public void setIntPing_Sucrate(double intPingSucrate) {
		intPing_Sucrate = intPingSucrate;
	}

	public double getIntFtp_Up_Sucrate() {
		return intFtp_Up_Sucrate;
	}

	public void setIntFtp_Up_Sucrate(double intFtpUpSucrate) {
		intFtp_Up_Sucrate = intFtpUpSucrate;
	}

	public double getIntFtp_Down_Sucrate() {
		return intFtp_Down_Sucrate;
	}

	public void setIntFtp_Down_Sucrate(double intFtpDownSucrate) {
		intFtp_Down_Sucrate = intFtpDownSucrate;
	}

	public double getIntUser_Seg_Sucrate() {
		return intUser_Seg_Sucrate;
	}

	public void setIntUser_Seg_Sucrate(double intUserSegSucrate) {
		intUser_Seg_Sucrate = intUserSegSucrate;
	}

	public double getIntUser_Roam_Sucrate() {
		return intUser_Roam_Sucrate;
	}

	public void setIntUser_Roam_Sucrate(double intUserRoamSucrate) {
		intUser_Roam_Sucrate = intUserRoamSucrate;
	}

	public double getIntWeb_Up_Delay() {
		return intWeb_Up_Delay;
	}

	public void setIntWeb_Up_Delay(double intWebUpDelay) {
		intWeb_Up_Delay = intWebUpDelay;
	}

	public double getIntWeb_Down_Delay() {
		return intWeb_Down_Delay;
	}

	public void setIntWeb_Down_Delay(double intWebDownDelay) {
		intWeb_Down_Delay = intWebDownDelay;
	}

	public double getIntPeap_Up_Delay() {
		return intPeap_Up_Delay;
	}

	public void setIntPeap_Up_Delay(double intPeapUpDelay) {
		intPeap_Up_Delay = intPeapUpDelay;
	}

	public double getIntHttp_Resp_Delay() {
		return intHttp_Resp_Delay;
	}

	public void setIntHttp_Resp_Delay(double intHttpRespDelay) {
		intHttp_Resp_Delay = intHttpRespDelay;
	}

	public double getIntPing_Delay() {
		return intPing_Delay;
	}

	public void setIntPing_Delay(double intPingDelay) {
		intPing_Delay = intPingDelay;
	}

	public double getIntFtp_Up_Speed() {
		return intFtp_Up_Speed;
	}

	public void setIntFtp_Up_Speed(double intFtpUpSpeed) {
		intFtp_Up_Speed = intFtpUpSpeed;
	}

	public double getIntFtp_Down_Speed() {
		return intFtp_Down_Speed;
	}

	public void setIntFtp_Down_Speed(double intFtpDownSpeed) {
		intFtp_Down_Speed = intFtpDownSpeed;
	}

	public double getIntAp_Corr_Suc_Counts() {
		return intAp_Corr_Suc_Counts;
	}

	public void setIntAp_Corr_Suc_Counts(double intApCorrSucCounts) {
		intAp_Corr_Suc_Counts = intApCorrSucCounts;
	}

	public double getIntAp_Corr_Total_Counts() {
		return intAp_Corr_Total_Counts;
	}

	public void setIntAp_Corr_Total_Counts(double intApCorrTotalCounts) {
		intAp_Corr_Total_Counts = intApCorrTotalCounts;
	}

	public double getIntWeb_Auth_Suc_Counts() {
		return intWeb_Auth_Suc_Counts;
	}

	public void setIntWeb_Auth_Suc_Counts(double intWebAuthSucCounts) {
		intWeb_Auth_Suc_Counts = intWebAuthSucCounts;
	}

	public double getIntWeb_Auth_Total_Counts() {
		return intWeb_Auth_Total_Counts;
	}

	public void setIntWeb_Auth_Total_Counts(double intWebAuthTotalCounts) {
		intWeb_Auth_Total_Counts = intWebAuthTotalCounts;
	}

	public double getIntWeb_Off_Suc_Counts() {
		return intWeb_Off_Suc_Counts;
	}

	public void setIntWeb_Off_Suc_Counts(double intWebOffSucCounts) {
		intWeb_Off_Suc_Counts = intWebOffSucCounts;
	}

	public double getIntWeb_Off_Total_Counts() {
		return intWeb_Off_Total_Counts;
	}

	public void setIntWeb_Off_Total_Counts(double intWebOffTotalCounts) {
		intWeb_Off_Total_Counts = intWebOffTotalCounts;
	}

	public double getIntPeap_Auth_Suc_Counts() {
		return intPeap_Auth_Suc_Counts;
	}

	public void setIntPeap_Auth_Suc_Counts(double intPeapAuthSucCounts) {
		intPeap_Auth_Suc_Counts = intPeapAuthSucCounts;
	}

	public double getIntPeap_Auth_Total_Counts() {
		return intPeap_Auth_Total_Counts;
	}

	public void setIntPeap_Auth_Total_Counts(double intPeapAuthTotalCounts) {
		intPeap_Auth_Total_Counts = intPeapAuthTotalCounts;
	}

	public double getIntPeap_Off_Suc_Counts() {
		return intPeap_Off_Suc_Counts;
	}

	public void setIntPeap_Off_Suc_Counts(double intPeapOffSucCounts) {
		intPeap_Off_Suc_Counts = intPeapOffSucCounts;
	}

	public double getIntPeap_Off_Total_Counts() {
		return intPeap_Off_Total_Counts;
	}

	public void setIntPeap_Off_Total_Counts(double intPeapOffTotalCounts) {
		intPeap_Off_Total_Counts = intPeapOffTotalCounts;
	}

	public double getIntHttp_Req_Suc_Counts() {
		return intHttp_Req_Suc_Counts;
	}

	public void setIntHttp_Req_Suc_Counts(double intHttpReqSucCounts) {
		intHttp_Req_Suc_Counts = intHttpReqSucCounts;
	}

	public double getIntHttp_Req_Total_Counts() {
		return intHttp_Req_Total_Counts;
	}

	public void setIntHttp_Req_Total_Counts(double intHttpReqTotalCounts) {
		intHttp_Req_Total_Counts = intHttpReqTotalCounts;
	}

	public double getIntFtp_Up_Suc_Counts() {
		return intFtp_Up_Suc_Counts;
	}

	public void setIntFtp_Up_Suc_Counts(double intFtpUpSucCounts) {
		intFtp_Up_Suc_Counts = intFtpUpSucCounts;
	}


	public double getIntFtp_Down_Suc_Counts() {
		return intFtp_Down_Suc_Counts;
	}

	public void setIntFtp_Down_Suc_Counts(double intFtpDownSucCounts) {
		intFtp_Down_Suc_Counts = intFtpDownSucCounts;
	}

	public double getIntFtp_Down_Total_Counts() {
		return intFtp_Down_Total_Counts;
	}

	public void setIntFtp_Down_Total_Counts(double intFtpDownTotalCounts) {
		intFtp_Down_Total_Counts = intFtpDownTotalCounts;
	}

	public double getIntUser_Seg_Suc_Counts() {
		return intUser_Seg_Suc_Counts;
	}

	public void setIntUser_Seg_Suc_Counts(double intUserSegSucCounts) {
		intUser_Seg_Suc_Counts = intUserSegSucCounts;
	}

	public double getIntUser_Seg_Total_Counts() {
		return intUser_Seg_Total_Counts;
	}

	public void setIntUser_Seg_Total_Counts(double intUserSegTotalCounts) {
		intUser_Seg_Total_Counts = intUserSegTotalCounts;
	}

	public double getIntUser_Roam_Suc_Counts() {
		return intUser_Roam_Suc_Counts;
	}

	public void setIntUser_Roam_Suc_Counts(double intUserRoamSucCounts) {
		intUser_Roam_Suc_Counts = intUserRoamSucCounts;
	}

	public double getIntUser_Roam_Total_Counts() {
		return intUser_Roam_Total_Counts;
	}

	public void setIntUser_Roam_Total_Counts(double intUserRoamTotalCounts) {
		intUser_Roam_Total_Counts = intUserRoamTotalCounts;
	}

	public String getDtCreatDate() {
		return dtCreatDate;
	}

	public void setDtCreatDate(String dtCreatDate) {
		this.dtCreatDate = dtCreatDate;
	}

	public String getStrStartTime() {
		return strStartTime;
	}

	public void setStrStartTime(String strStartTime) {
		this.strStartTime = strStartTime;
	}

	public String getStrEndTime() {
		return strEndTime;
	}

	public void setStrEndTime(String strEndTime) {
		this.strEndTime = strEndTime;
	}
    
    

   }